//
//  LZRushCouponDetailTitleCell.m
//  LzzizDemo
//
//  Created by xbnzd on 16/11/7.
//  Copyright © 2016年 xbnzd. All rights reserved.
//

#import "LZGrabCouponDetailTitleCell.h"
#import "GiftListLabel.h"

@interface LZGrabCouponDetailTitleCell()
@property (weak, nonatomic) IBOutlet GiftListLabel *couponTitlelabel;
@end

@implementation LZGrabCouponDetailTitleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self configureLabel];
    // Initialization code
    self.couponTitlelabel.preferredMaxLayoutWidth = SCREEN_WIDTH - 20;
}

- (void)loadTitle:(NSString *)title
{
    [self setRulesContentLabelText:title];
}

- (void)setRulesContentLabelText:(NSString *)text
{
    if (text.length <= 0) {
        return;
    }
    extern CGFloat textLineSpace;
    NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:text];
    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
    
    [style setLineSpacing:textLineSpace];
    [style setLineBreakMode:NSLineBreakByWordWrapping];
    [style setAlignment:NSTextAlignmentNatural];
    
    [attStr addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, attStr.length)];
    self.couponTitlelabel.attributedText = attStr;
}

#pragma mark -
#pragma mark action
- (void)configureLabel
{
    [self.couponTitlelabel setVerticalAlignment:VerticalAlignmentTop];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
